import Vue from "vue";

import App from "./App.vue";
import VueRouter from "vue-router";

import Layout from "./views/Layout.vue";
import Users from "./views/Users.vue";
import Posts from "./views/Posts.vue";
import Comments from "./views/Comments.vue";

Vue.use(VueRouter);

const router = new VueRouter({
  routes: [
    {
      path: "/index",
      component: Layout,
      children: [
        {
          path: "users",
          component: Users, // Layout>RouterView
        },
      ],
    },
    {
      path: "/index",
      component: Layout,
      children: [
        {
          path: "posts",
          component: Posts, // Layout>RouterView
        },
      ],
    },
    {
      path: "/index",
      component: Layout,
      children: [
        {
          path: "comments",
          component: Comments, // Layout>RouterView
        },
      ],
    },
  ],
});

new Vue({
  el: "#app",
  router,
  render: (h) => h(App),
});
